package com.android.BluethootChess.model;

import com.android.BluethootChess.util.Utils;

public class GameBoardMatrix {
	private byte[][] gameBoard;

	public GameBoardMatrix() {
		gameBoard = new byte[Utils.BOARD_SIZE][Utils.BOARD_SIZE];
		for (int i=0;i<Utils.BOARD_SIZE;i++){
			for (int j=0;j<Utils.BOARD_SIZE;j++){
				gameBoard[i][j]=-1;
			}
		}
	}

	public void setGameBoard(byte[][] gameBoard) {
		this.gameBoard = gameBoard;
	}

	public byte[][] getGameBoard() {
		return gameBoard;
	}

	/**
	 * Creaza o reprezentare a tablei de sah, pentru un joc nou.
	 * */
	public void newGame(){
		for (int i=0;i<Utils.BOARD_SIZE;i++){
			gameBoard[1][i]=(byte) PieceTypeAndColor.BLACK_PAWN.ordinal();
			gameBoard[Utils.BOARD_SIZE-2][i]=(byte)PieceTypeAndColor.WHITE_PAWN.ordinal();
		}
		
		gameBoard[0][0]=(byte) PieceTypeAndColor.BLACK_ROOK.ordinal();
		gameBoard[0][1]=(byte) PieceTypeAndColor.BLACK_KNIGHT.ordinal();
		gameBoard[0][2]=(byte) PieceTypeAndColor.BLACK_BISHOP.ordinal();
		gameBoard[0][3]=(byte) PieceTypeAndColor.BLACK_QUEEN.ordinal();
		gameBoard[0][4]=(byte) PieceTypeAndColor.BLACK_KING.ordinal();
		gameBoard[0][5]=(byte) PieceTypeAndColor.BLACK_BISHOP.ordinal();
		gameBoard[0][6]=(byte) PieceTypeAndColor.BLACK_KNIGHT.ordinal();
		gameBoard[0][7]=(byte) PieceTypeAndColor.BLACK_ROOK.ordinal();
		
		gameBoard[Utils.BOARD_SIZE-1][0]=(byte) PieceTypeAndColor.WHITE_ROOK.ordinal();
		gameBoard[Utils.BOARD_SIZE-1][1]=(byte) PieceTypeAndColor.WHITE_KNIGHT.ordinal();
		gameBoard[Utils.BOARD_SIZE-1][2]=(byte) PieceTypeAndColor.WHITE_BISHOP.ordinal();
		gameBoard[Utils.BOARD_SIZE-1][3]=(byte) PieceTypeAndColor.WHITE_QUEEN.ordinal();
		gameBoard[Utils.BOARD_SIZE-1][4]=(byte) PieceTypeAndColor.WHITE_KING.ordinal();
		gameBoard[Utils.BOARD_SIZE-1][5]=(byte) PieceTypeAndColor.WHITE_BISHOP.ordinal();
		gameBoard[Utils.BOARD_SIZE-1][6]=(byte) PieceTypeAndColor.WHITE_KNIGHT.ordinal();
		gameBoard[Utils.BOARD_SIZE-1][7]=(byte) PieceTypeAndColor.WHITE_ROOK.ordinal();
		
	}
	
}
